package day10.practice;

/**
 * @Author juzipi
 * @Date 2021/6/24 15:36
 * @Info
 */
public class Account {

    private Integer id;

    private Double balance;

    public Account(Integer id, Double balance) {
        this.id = id;
        this.balance = balance;
    }

    public void deposit(double balance) {
        if (balance > 0) {
            this.balance += balance;
            System.out.println("存钱成功");
        }
    }

    //取钱
    public void withdraw(double balance) {
        if (this.balance < balance) {
            System.out.println("取钱失败");
        }
        this.balance -= balance;
        System.out.println("取钱成功");
    }


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Double getBalance() {
        return balance;
    }

    public void setBalance(Double balance) {
        this.balance = balance;
    }
}
